
#include "TCPServer.hpp"
#include "Service.hpp"
#include "NetCal.hpp"
#include "Socket.hpp"

int main(int args, char *argv[])
{
    if (args < 2)
    {
        LOG(FATAL, "too few arguments!\n");
        exit(0);
    }
    uint16_t port = std::stoi(argv[1]);

    NetCal cal;
    IOService service(std::bind(&NetCal::Calculator, &cal, std::placeholders::_1));

    TCPServer server(std::bind(&IOService::IOExcute, &service, std::placeholders::_1, std::placeholders::_2),
                     port);
    server.Loop();
}